package com.corgi.webservice.service.impl;

import com.corgi.webservice.service.MapService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.jws.WebService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @title: MapServiceImpl
 * @description:
 * @author: dengmiao
 * @create: 2019-10-12 09:18
 **/
@Slf4j
@WebService(serviceName="mapService",
		targetNamespace="http://service.webservice.corgi.com/",
		endpointInterface="com.corgi.webservice.service.MapService")
@Component
public class MapServiceImpl implements MapService {

	@Override
	public List<Map> values(String param) {
		log.info("invoke com.corgi.webservice.service.impl.MapServiceImpl.values({})", param);
		final Map<String, String> map = new HashMap<String, String>(2){
			{
				put("1", "张三");
				put("2", "李四");
			}
		};
		List<Map> list = map.keySet().stream().map(key -> {
			Map m = new HashMap(1);
			m.put(key, map.get(key));
			return m;
		}).collect(Collectors.toList());
		log.info("map convert to list: {}", list);
		return list;
	}
}
